<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>2.点我,我就闪</title>
  </head>
  <style type="text/css">
    body {
      background: black;
    }
    #box {
      position: absolute;
      top: 50%;
      left: 50%;
      color: #fff;
      width: 200px;
      height: 200px;
      background: skyblue;
      cursor: pointer;
      letter-spacing: 5px;
      text-align: center;
      font: 12px/200px Arial;
      margin: -100px 0 0 -100px;
    }
  </style>
  <body>
    <div id="box">点我，我就闪</div>
  </body>
  <script type="text/javascript">
    var oBox = document.getElementById("box");
    var timer = null;
    oBox.onclick = function () {
      var i = 0;
      clearInterval(timer);
      timer = setInterval(function () {
        oBox.style.display = i++ % 2 ? "none" : "block";
        i > 6 && clearInterval(timer);
      }, 80);
    };
  </script>
</html>
